{include file="public_head"}
{include file="public_menu"}
<div class="content_center">
  <div class="main_center">
    {include file="public_information_menu"}
    <div class="main_right right">
      <div class="main_right_title">修改支付密码</div>
      <div class="main_safety">

        <div class="center-pass">

          <div>
            <form action="" method="post" id="form">
            <div>
                <label>旧的支付密码</label>
                <input type="password" class="text" name="old_password" datatype="n6" placeholder="请输入旧的支付密码，以验证身份"  nullmsg="请输入旧的支付密码" errormsg="6位数字支付密码">
                <a href="{:url('AccountSecurity/SetPassword')}">忘记支付密码</a>
            </div>
            <div>
              <label>新支付密码</label>
              <input type="password" class="text" name="new_password" datatype="n6" placeholder="请设置6位数支付密码" nullmsg="请输入新的支付密码" errormsg="6位数字支付密码">
            </div>
            <div>
              <label>再次输入确认</label>
              <input type="password" class="text" name="unpwd" datatype="n6" placeholder="请设置6位数支付密码" nullmsg="请输入新的支付密码" errormsg="6位数字支付密码">
            </div>
            <div>
              <input type="submit" value="完成" class="submit" id="sub">
            </div>
            </form>
          </div>

        </div>

      </div>
    </div>
  </div>
  <script>
    // 修改密码提交
    $(function () {
      $.Tipmsg.r = null;
      $.Tipmsg.p = null;
      $.Datatype.n6 = /^\d{6}$/;
      // 表单验证
      $("#form").Validform({
        tiptype: function (msg) {
          layer.msg(msg, {icon: 2});
        },
        btnSubmit: '#sub',
        tipSweep: true,
        // ajax 提交
        ajaxPost: true,
        callback: function (t) {
          if (t.code == 200) {
            layer.msg('修改成功', {icon: 1});
            // 跳转页面
            setTimeout(function(){
              layer.closeAll('loading');
              // 跳转页面
              location.href = "{:url('account_security/index')}";
            }, 3000);
          } else {
            layer.msg(t.message, {icon: 2});
            setTimeout(function(){
              layer.closeAll('loading');
              // 跳转页面
              location.reload();
            }, 3000);
          }

        }
      });
    })
  </script>
  {include file="public_foot"}